package cn.zf233.xcloud.mapper;

import cn.zf233.xcloud.entity.File;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by zf233 on 2020/11/4
 */
public interface FileMapper {

    File selectByPrimaryKey(Long id);

    File selectByRandomFileName(String randomFileName);

    Integer deleteByPrimaryKey(Long id);

    Integer insert(File file);

    Integer insertBatch(List<File> fileList);

    File selectRootNodeOfUserByPrimaryKey(Long userid);

    List<File> selectFilesByUserIDAndParentID(@Param(value = "userid") Long userID, @Param(value = "parentid") Long parentID);

    List<File> selectFilesByUserIDAndClassify(@Param(value = "userid") Long userID, @Param(value = "classify") Integer classify);

    List<File> selectFiles();

    Integer updateByPrimaryKeySelective(File file);

    List<File> selectFilesByUserIDAndMatchCode(@Param(value = "userid") Long id, @Param(value = "matchcode") String matchCode);

    List<File> selectFilesByUserIDAndParentIDSortByTypeAsce(@Param(value = "userid") Long id, @Param(value = "parentid") Long parentId, @Param(value = "filed") String field);

    List<File> selectFilesByUserIDAndParentIDSortByTypeDesc(@Param(value = "userid") Long id, @Param(value = "parentid") Long parentId, @Param(value = "filed") String field);

    List<File> selectFilesByUserIDAndDeleteFlag(Long userid);

    Long classChartAll(Integer classify);

    Long classChart(@Param(value = "userId") Long userId, @Param(value = "classify") Integer classify);

    Long recycleSizeAll();

    Long recycleSize(Long userId);

    Long selectTotalFileSizeByUserId(Long userId);

    List<Long> getWildFiles();

}